<% extend 'shared/admin-base' %>

<% block 'head': %>
<link rel="stylesheet" href="/dist/admin-account.css">
<% end %>

<div class="row">
    <div class="col-md-12">
        <!-- BEGIN EXAMPLE TABLE PORTLET-->
        <div class="portlet box blue">
            <div class="portlet-title">
                <div class="caption"><i class="fa fa-globe"></i>人员列表</div>
                <div class="tools">

                </div>
            </div>
            <div class="portlet-body">
                <div class="table-toolbar">
                    <div class="btn-group">
                        <a href="#addmodal" data-toggle="modal" class="btn green">
                            添加 <i class="fa fa-plus"></i>
                        </a>
                    </div>

                </div>
                <table class="table table-striped table-bordered table-hover" id="sample_2">
                    <thead>
                    <tr>
                        <th>序号</th>
                        <th>登陆名</th>
                        <th>姓名</th>
                        <th>电话</th>
                        <th>权限</th>
                        <th>店名</th>
                        <th>商店序号</th>
                        <th style="width:150px">操作</th>
                    </tr>
                    </thead>
                    <tbody>

                    <% for user in @admin : %>
                    <tr data-id="<%= user.id %>" class="odd gradeX">
                        <td><%= user.id %></td>
                        <td><%= user.nickname %></td>
                        <td><%= user.name %></td>
                        <td><%= user.phone %></td>
                        <% if user.type==1 : %>
                        <td>普通管理员</td>
                        <% else if user.type==2 : %>
                        <td>运营员</td>
                        <% else if user.type==3 : %>
                        <td>业务员</td>
                        <% else if user.type==100 : %>
                        <td>超级管理员</td>
                        <% end %>
                        <td><%= user.shop.title %></td>
                        <td><%= user.shop.id %></td>
                        <td>
                            <a data="<%= user.id %>" href="#addmodal" data-toggle="modal"
                               class="btn blue btn-xs editbtn"><i class="fa fa-edit"></i>修改</a>
                            <% if user.type !=100 : %>
                            <butten class="btn delbtn btn-warning btn-xs"><i class="fa fa-times"></i>删除</butten>
                            <% end %>

                        </td>
                    </tr>
                    <% end %>

                    </tbody>
                </table>
            </div>
        </div>
        <!-- END EXAMPLE TABLE PORTLET-->
    </div>
</div>


<div id="addmodal" class="modal fade" tabindex="-1" aria-hidden="true">
    <input type="hidden" name="shopTitle" id="shopTitle"/>
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                <h4 class="modal-title" align="center">添加</h4>
            </div>
            <div class="modal-body" style="">
                <div class="row">
                    <form id="form" method="post" action="/adminer-super/accountadd" class="form">
                        <input type="hidden" name="id" id="id" class="col-md-12 form-control">
                        <div class="form-group">
                            <div class="col-md-12">
                                <h4>登陆名</h4>

                                <p><input type="text" name="nickname" id="nickname" class="col-md-12 form-control"></p>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-md-12">
                                <h4>姓名</h4>

                                <p><input type="text" name="name" id="name" class="col-md-12 form-control"></p>
                            </div>

                        </div>
                        <div class="form-group">
                            <div class="col-md-12">
                                <h4>手机</h4>

                                <p><input type="text" name="phone" id="phone" class="col-md-12 form-control"></p>
                            </div>

                        </div>

                        <div class="form-group">
                            <div class="col-md-12">
                                <h4>商店序号</h4>

                                <p><input type="text" name="shopId" id="shopId" class="col-md-12 form-control"/></p>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-md-12">
                                <h4>权限</h4>
                                <select name="type" id="type" class="form-control">
                                    <option>请选择</option>
                                    <option value="1">普通管理员</option>
                                    <option value="2">运营员</option>
                                    <option value="3">业务员</option>
                                    <option value="100" disabled id="super-option">超级管理员</option>
                                </select>
                            </div>

                        </div>
                        <div class="form-group">
                            <div class="col-md-12">
                                <h4>密码</h4>
                                <input type="password" id="password" name="password" class="form-control">

                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-md-12">
                                <h4>确认密码</h4>
                                <input type="password" id="password2" name="password2" class="form-control">
                            </div>

                        </div>
                        <span class="span"></span>

                        <div class="">
                            <div class="col-md-12" style="margin-top: 10px">
                                <button style="float: right" type="submit" id="add1btn" class="btn green">保存</button>
                            </div>
                        </div>
                    </form>
                </div>

            </div>
            <div class="modal-footer">
            </div>
        </div>
    </div>
</div>


<% block 'scripts': %>
<script src="/dist/admin-account.js"></script>
<% end %>
